﻿<!doctype html>
<html>
<!-- InstanceBegin template="/Templates/template1.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta charset="utf-8">
<!-- InstanceBeginEditable name="doctitle" -->
<title>优惠券明细</title>
<!-- InstanceEndEditable -->
<script type="text/javascript" src="../js/common.js"></script>
<link href="../css/Pager.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="../js/jquery.pager.js"></script>
<script type="text/javascript" src="../js/gbRst.js"></script>
<link href="../css/style.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="../js/utils.js"></script>
<script type="text/javascript" src="../js/shopSelecterNew.js"></script>
<script type="text/javascript" src="../js/checkLogin.js"></script>
<script type="text/javascript" src="../js/find.js"></script>
<script type="text/javascript" src="../js/pagination.js"></script>
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
<script type="text/javascript" >
$(function(){
	$("#shopIsChoosed").click(function(){
		if($("#shopIsChoosed").is(":checked")){
			$("#shopName").attr("disabled",false);
			$("#research").attr("disabled",false);
			
		}else{
			$("#shopName").attr("disabled",true);

		}
	});
})

function InitTable(pageIndex) {
	if(IsNotEmpty(pageIndex)){
		_pageIndex = pageIndex;
	}
	var phone=$("#phone").val().replace(/\s/gi,'');	
	var code=$("#code").val().replace(/\s/gi,'');
	var status=$("#status").val();
	var dtBegin=$("#dtBegin").val();
	var dtEnd=$("#dtEnd").val();
	var shopId="";
	var param='phone='+phone+'&code='+code+"&status="+status+"&dtBegin="+dtBegin+"&dtEnd="+dtEnd;
	if($("#shopIsChoosed").is(":checked")){
		shopId=$("#shopName").val();
		
		if(shopId!=""&&shopId!=null){
			param+="&shopId="+shopId;
		}
	}
	
	var dt = _findInfo("../memberConpDt/find/memberCouponDetailList/"+(_pageIndex - 1)+"/10", param);
				if(dt.state==0){
				var params = new Array("ruleName", "CouponNo","MemberCardNo","CustomerName","mp","CouponCount", "FaceValue", "GrantDate", "UneffectDate", "GetMode",  "staName");				
				_loadInfo(dt, "memberList", params)
				_loadPage("pager", _pageIndex, 10, dt, InitTable, "NoResult")
			$("#sup").html("共"+dt.result.len+"条");	

		}
	var dt = _findInfo("../memberConpDt/find/sumoffacevalue", param);
				if(dt.state==0){
					if(dt.result.len > 0){
						$("#sum").html("总计："+ getHtmlInt(getHeadIndexValue(0, dt, "sum")) +"元")
					}else{
						$("#sum").html("");
					}	

		}	
}


function search(){
	InitTable(1);
}

function  downRescouse(){
	var phone=$("#phone").val().replace(/\s/gi,'');	
	var code=$("#code").val().replace(/\s/gi,'');
	var status=$("#status").val();
	var dtBegin=$("#dtBegin").val();
	var dtEnd=$("#dtEnd").val();
	var shopId="";
	var param='phone='+phone+'&code='+code+"&status="+status+"&dtBegin="+dtBegin+"&dtEnd="+dtEnd;
	if($("#shopIsChoosed").is(":checked")){

		
		shopId=$("#shopName").val();
		
		if(shopId!=""&&shopId!=null){
			param+="&shopId="+shopId;
		}
	}
	param+="&downType=2"
	
	window.location.href="../csvdown/down/csv/down?"+param

}



</script>
</head>

<body>

<!-- InstanceBeginEditable name="EditRegion3" --> 
<script type="text/javascript" src="../js/doubleDate2.0.js"></script> 
<script type="text/javascript">
$(function(){
	refreshInput($(".serWrapper"));
	$('.doubledate').kuiDate({
		className:'doubledate',
		isDisabled: "0"  // isDisabled为可选参数，“0”表示今日之前不可选，“1”标志今日之前可选
	});

});
</script>
<div class="container" id="container">
  <div class="container_R fr">
    <div class="place">优惠券明细</div>
    <div class="member_search">
      <p><span>
        <input type="checkbox" id="shopIsChoosed" style="width:auto;height:auto;border:none;">
        店面：</span>
        <select id="shopName" onclick="openShopListPanel(this)" style=";height:20px;" disabled="disabled">
        </select>
        <span>起始日期：</span>
        <input type="text" readonly class="doubledate ipticon"  id="dtBegin"/>
        <span>截止时间：</span>
        <input type="text" readonly class="doubledate ipticon" id="dtEnd"/>
      </p>
      <p>
        <span>手机号：</span>
        <input type="text" id="phone" class="absoluteTxt">
      <span>优惠券编号：</span>
        <input type="text" id="code" class="absoluteTxt">
        <span>状态：</span>
        <select id="status">
          <option value="">所有</option>
          <option value="0">可用</option>
          <option value="1">已使用</option>
        </select>
        <input type="button" value="查询" class="btn" onclick="search()">
      </p>
    </div>
    <table width="100%" class="member_list" cellpadding="0" cellspacing="1" border="0" id="memberList">
      <caption>
     <strong>优惠券列表 <span id="sup">共0条</span> </strong> <a href="javascript:void(0)" onclick="downRescouse()">导出数据</a>
      </caption>
      <thead>
        <tr>
          <th>优惠券名称</th>
          <th>优惠劵号</th>
          <th>会员卡号</th>
          <th>客户姓名</th>
          <th>手机</th>
          <th>数量 </th>
          <th>面值 </th>
          <th>创建时间 </th>
          <th>失效时间</th>
          <th>来源</th>
          <th>状态</th>
        </tr>
      </thead>
      <tbody>
      </tbody>
    </table>
     <div id="NoResult"  class="Nothing" style="text-align:center;display: none;">无符合条件的数据！</div>
    <div id="sum" style="float: left;"></div>
    <div id="pager" style="float: right;"></div>
  </div>
  <div class="fc"></div>
</div>
<!-- InstanceEndEditable --> 
<script type="text/javascript" src="../js/header.js"></script> 
<script type="text/javascript" src="../js/left.js"></script> 
<script type="text/javascript" src="../js/footer.js"></script> 
<script type="text/javascript">
clearThis("absoluteTxt");
showTab(4,3);
</script>
</body>
<!-- InstanceEnd -->
</html>
